import jdk.nashorn.api.scripting.ScriptUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author dragon
 * @version 1.0
 * @description 数组的协变的理解
 * @date created in 2018-11-06
 */
public class Test4 {

    public static void main(String[] args) {
        /**
         * 数组的协变 :假设 A 是 B 的子类,则 B[] array = new A[10];可以编译通过
         */
        Person[] array = new Student[10];
        Student s1 = new Student("1班");
        Student s2 = new Student("2班");
        array[0] = s1;
        array[1] = s2;
//		Person p1 = new Person();
//		array[2] = p1;
//		List<? extends Person> arrayList = new ArrayList<Student>();
//		ArrayList<Integer> list = new ArrayList<>();
//		list.hashCode();

        Person p = new Student();
        try {
            Object test = p.test();
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
